package com.yang.controller;
import java.util.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.yang.service.RegisterService;
import com.yang.util.SnowFlake;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.yang.service.TestService;

@Controller
public class TestController {

	@Resource
	TestService testService;
//	@Resource
//	RegisterService registerService;

	List<Long> idList = new ArrayList<Long>();
	@RequestMapping(produces="application/json;charset=UTF-8",
			value="getExamTime",method= {RequestMethod.POST})
	@ResponseBody
	public Map<String,Object> test(HttpServletRequest Request, 
			HttpServletResponse Response,String id){
		System.out.println(id);
		Map<String,Object> map = new HashMap<String,Object>();
		map= testService.testSercive(id);
		return map;
	}
//	@RequestMapping(value = {"/","index.html"})
//	public String  printedPage(HttpServletRequest request, HttpServletResponse response)  {

//		SnowFlake sno = new SnowFlake(1,1);
//		//start();
//		for(int i=0;i<100;i++){
//			long b = sno.getId();
//			idList.add(b);
//			System.out.println(b);
//		}
//		Set<Long> set = new HashSet<Long>();
//		for(int i=0;i<idList.size();i++){
//			if(!set.add(idList.get(i))){
//				System.out.println("重复出现"+idList.get(i));
//			}
//		}
//		registerService.getCode("2456064131@qq.com");
//		registerService.getCode("2456064131@qq.com");
//		return "index";
//	}

//	@Override
//	public void run() {
//		SnowFlake sno = new SnowFlake(1,1);
//		for(int i=0;i<100;i++){
//			long b = sno.getId();
//			idList.add(b);
//			System.out.println(b);
//		}
//	}
}
